{include file="common/header"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
              <div class="layui-card-body">
                  <div class="layui-row">
                      <form action="" class="layui-form">
                          <div class="layui-row layui-col-space10">
                              <div class="layui-inline">
                                  <div class="layui-input-inline">
                                      <select name="wx_id" id="wx_id">
                                          {volist name="wechat" id="vo"}
                                          <option value="{$vo.id}">{$vo.name}</option>
                                          {/volist}
                                      </select>
                                  </div>
                                  <input type="button" id="searchBtn" name="submit" class="layui-btn" value="搜索">
                              </div>
                          </div>
                      </form>
                  </div>
                <div class="layui-row">
                    <table class="layui-table" id="list" lay-filter="list"></table>
                </div>
              </div>
            </div>
        </div>
    </div>
</div>
{include file="common/footer"/}


<script type="text/html" id="imageTpl">
    {{d.nickname}}<img src="/static/admin/images/image.gif" onmouseover="layer.tips('<img src={{d.headimgurl}}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();">
</script>
<script type="text/html" id="addressTpl">
    {{d.country}}  {{d.province}}{{d.city}}
</script>
<script type="text/html" id="subscribe_timeTpl">
    {{layui.util.toDateString(d.subscribe_time*1000, 'yyyy-MM-dd HH:mm:ss')}}
</script>
<script type="text/html" id="sexTpl">
    {{#  if(d.sex == 1){ }}
	  男
	{{#  } else { }}
	  女
	{{#  } }} 
</script>


<script>
var table;
var searchObj = {};
searchObj['wechat_id'] = $('#wx_id option:selected').val();
var tree;
var channel_ids = [];
layui.use(['table','form','laydate','tree'],function(){
  table = layui.table;
  tree = layui.tree;
  var form = layui.form;
  table.render({
    elem: '#list'
    ,url:'{:url("index")}'
    ,method:'post'
    ,where:searchObj
    ,cellMinWidth: 60
    ,limit:20
    ,limits:[20,40,60,80,100]
    ,title: '内容列表'
    ,id:'list'
    ,cols: [[
        {type:'checkbox',fixed: true}
        ,{field:'openid', title: 'OpenID',fixed: true}
        ,{field:'nickname', title: '昵称', templet:'#imageTpl'}
        ,{field:'title', title: '性别', templet:'#sexTpl'}
        ,{title: '地址', templet:'#addressTpl'}
        ,{field:'subscribe_time', title: '关注时间', templet:'#subscribe_timeTpl'}
    ]]
    ,page: true
  });
    // 搜索
    $('#searchBtn').click(function(){
        searchObj['nickname'] = $('#nickname').val();
        table.reload('list',{where:searchObj});
    }) 
});

</script>
